Repository navigation
No second run on a ticket whose pull request already merged - #706
Conversation
On one team's app, watched over seven months, duplicate runs made up most of CoderHelm's unmerged pull requests. A retry, a ticket edit, or a run started while the first pull request had merged into an integration branch rebuilt the same change from nothing. Before a fresh run on a person's ticket (a Jira key or a GitHub issue) does any work, it now checks the ticket's pull requests: the ones its earlier runs opened, and any whose title, branch or description names the ticket, by any author and into any base branch. CoderHelm already reads these for the ticket's history. When one merged, the run stops before a repository is picked or a model is called. The run page and the ticket say which pull request merged, into which branch and when, and how to run the ticket anyway. The run ends waiting on a person, with `stop_kind: already_merged`. A person runs the ticket anyway by pressing Retry on the stopped run, reopening the Jira ticket, or replying on the ticket with what is still to do. A run started that way is recorded, so its retries and later runs on the ticket aren't stopped by the same merge; a newer merge stops them again. CoderHelm's own work (alerts, log findings, flaky tests, security fixes, plan tasks) is never stopped, because the same finding can come back after its fix merged. The trigger gate: - A ticket edit after such a stop starts nothing, so the ticket doesn't collect one stop after another. Reopening it, or Retry, starts the work. - After 3 failed runs in a row, an event that leaves the ticket unchanged starts no further run. A field or status change used to start the same failing run every time. An edit, a reopen, Retry or a command still start one. Open pull requests that already do the work were handled before this change and still are. Deferred: - Holding a run while the ticket's blocking links are open: the Jira app doesn't send issue links yet, and what happens when a blocker closes is a product decision. - A ticket-level target-branch field: a target branch written in the ticket text is already honoured. A field needs the Jira app to send custom fields and a decision on which field to read.
… and a run delivers its change whatever outside work it needs (#703) * A description gets a final review before it is posted, follows the repository's template, and a run delivers its change whatever outside work it needs A pull request description showed six checks as "still running when this was written" and never changed them, asked a person for deploy credentials in a repository that deploys staging from a label CoderHelm adds, said the file to read first and the way back twice each, closed its review focus with "nothing is out of the ordinary", named a page by its raw id, and listed running and did-not-run checks on one line. The repository's template only guided the first draft. - Final review in the one save (common::pr_review): a running check reads Running and is never a result; nothing the gate does not let through reaches a person; nothing said twice; no filler; no raw id beside a name; running and did-not-run said apart. - Running checks render as Running, the conclusion says they are still running, and the stamp marks the description for a rebuild until they end, so the checks step, the watch and the end of the run replace them. - The reviewer guide gives way to the lead (it said Read first and Rollback again); its own lines keep running apart from did-not-run. - A staging deploy the repository lets CoderHelm start (a dispatchable or labelled workflow) is CoderHelm's step (outside_work::own_startable). - The repository's pull request template is the visible structure: its headings in order, filled with CoderHelm's content (common::pr_template, pr_body::render_templated); the rebuild reads it, cached per repository. - A plan with code is implemented and its pull request opened whatever outside work it needs (route_for_plan), and a run whose pull request is open ends completed, with person-only items listed once under Needed from you and on the run page. - Incident case bl replays the posted description with neutral names. * A deploy CoderHelm can start is found, started and recorded, and feedback about outside work keeps the code change - Detection: a staging deploy job a pull request label starts, or a dispatchable staging workflow, is a deploy route even when it is not the CMS's; label conditions are read with or without spaces; a run line that runs a package deploy script counts. A production-only route is never taken for staging. - The gate is told: classify_with sets person_gate::Context::can_deploy from the repository's routes, and a deploy CoderHelm can start and has not tried is never a person's credential item (an attempt whose own cause is a listed reason still is). The executor classifies with it. - Executed, not reworded: next_action gives the moved step its route's action (label or dispatch); record_end records the run that ended on the step, which the resume saves on the run. - Feedback: a person saying part of the fix is outside the code keeps the open pull request and its code when the plan coded (route_for_feedback), records the outside part on the run's decision and lists it on the pull request; only a pull request with no code to keep is closed as before. - Incident bl: three cases for the above.
* Keep every event path inside its team An audit of inbound webhooks, live streams, queues, notifications, team knowledge and caches found four keys that named a shared thing instead of the team. Each is proven by a test that failed before the fix. - Slack workspace and Teams webhook links are claimed by one team at a time (flag::claim_chat); another team's link is refused, an unlink only drops the caller's own, and inbound routing requires the team's settings to still name the key. - Run page GitHub check reads are cached per installation (read_key), so a same-named repository never gets another installation's cached checks. - Composed replies are cached by the full prompt they were written from, so two Jira sites sharing a ticket key and comment id never share one. - Run event rows carry team_id; every read keeps only the asking team's rows, all through common::run_events. - The plan chat stream token is scoped to its stream, like the brain's. Incident case bm_teams_never_cross scans for new inbound routes, process-wide caches and direct events table access that don't say how they stay in their team. * Keep the plain session token builder for tests only The plan chat stream was its last caller outside tests; streams now use scoped tokens. * Key the PR template cache by installation, as every process-wide cache is * Read the installation through its accessor
…715) * A description built by an earlier writer is rebuilt after an upgrade The description stamp named the head, the digest of the checked text and running checks, never the writer that built it, so a pull request opened before an upgrade kept its old layout and wording on an unchanged head. - The stamp carries the writer version (description::WRITER, now 2). A stamp without a version, or with another, is not current. Old stamps still parse. - The pull request watch sweep catches up open pull requests CoderHelm opened, whatever the age of their run: up to 3 per team and 15 per sweep, inside the sweep's GitHub budget, through the one rebuild (reconcile_run, final review in save). Each is marked on its run (description_writer) so it is read once per writer version. - A description with no CoderHelm stamp, or whose checked text a person changed, is left as it is. - Incident bn replays an old-layout description on an unchanged head. * The catch-up builds a description wholly CoderHelm's from the facts alone An older description had no lead or reviewer-block markers, so its rebuild kept the old lines (frozen "still running" rows, "Look first", "Roll back") in a fold. When the stamp's digest still matches, nothing in the body is a person's: the catch-up (description::catch_up_run) now drops the old body and renders it from the facts of the head, keeping only a line that closes an issue. The build checks the body again as it reads it, so an edit made since the sweep looked is never written over.
…ges anything (#722) A throttled DescribeChangeSet during the deploy role check came back as "couldn't check", failed the update and told the admin to press Update again. Throttling now never counts as a refusal: every AWS client uses botocore's adaptive retry mode, each step before the change set runs is tried again with backoff and jitter, and the update (or the Update press) keeps waiting as "AWS is busy, retrying (attempt n)". Only after 10 minutes does it fail, in words that ask nothing of anyone, and it starts again by itself 30 minutes later unless an admin cancels it (DELETE /api/system/update). The model check stays pending, never refused, while AWS is busy.
…ime continues (#726) A review-fix round that answered a finding with proof and pushed nothing was never read by a review: the parked round's end marked the pull request ready and completed, the completion guard reran the checks (which never review the head), and the next look refused another round on the same head and held the draft for a person. A check the step was too short to start was counted as a block and could end in that same hold. - A round that pushed nothing, or used every step, goes back to a review of the same head; the reviewer is given the round's account and the rule for judging proof. A finished run whose last round no review read is sent back to that review on the next look of the ready sweep or the pull request watch, so stuck runs recover by themselves. - A command, run_checks or codegen a step is too short to start is owed: the pass continues in a fresh step that runs it first. A round cut short by time is neither a stall nor a block in the ledger. - No CoderHelm limit holds a draft for a person: what is left after every approach is listed as CoderHelm's note, the pull request goes ready, and CoderHelm's verdict is kept so nothing merges over it. Passing moments (a race, a read that failed) are waits. - Incident bt reproduces the case.
…e send errors (#727) The relay refused set-up and forgot-password emails (inviter_not_admin): only the config's admins were ever listed as relay admins, so the owner and other admins, copied-over ones included, could not vouch. The install now names all its admins to a new signed /hybrid/email/admins sync, after role changes and whenever the relay refuses an admin, then retries. An unconfirmed Cognito sign-up counts as no account: forgot-password and the Members page send the set-up email, and signing up again replaces it. Refused sends answer with the reason. The custom-message Lambda reads SES v2's TemplateContent.
POST /api/brain/threads/delete takes up to 100 ids and deletes each one the caller started, in their own team, with the same checks as the single delete (now shared in delete_verdict). Someone else's private chat or another team's id answers "No such chat."; a teammate's shared chat is refused. Each id gets its own result, and one failure stops nothing else.
…ent from the install (#730) - A GitHub-only record (no email) next to the same person's record by email is folded into it at their GitHub sign-in: the higher built-in role stays and the GitHub-only record is removed. The GitHub email is never written onto a second record on the same team. - The GitHub id lookup reads every record instead of one at random, so an install's own record (or, hosted, the team someone was added to) wins. - An invite dated before the organization was made on the install and never sent from it is offered by forgot-password and the bulk set-up email; sending it restarts its 30 days. - A refused password sign-in is logged by cause; no sign-in here is info. Depends on #727.
#724) Rust (clippy) and Rust (tests) still run on every pull request and report, but a changed-files check against the merge base skips their steps when no file the workspace builds, embeds or scans changed (a dashboard pin in selfhost/versions.json). The list lives in .github/scripts/rust_affected.py with a unit test; anything uncertain runs everything.
work_needs_me gathers what waits on the asker, side by side and time-bounded: run questions (with their options), runs waiting on an outside change, Coderhelm's open pull requests on their own work, tool calls held for an admin, Jira tickets assigned to them or mentioning them unanswered, and GitHub review requests, their own pull requests with changes asked for or failing checks, and unanswered mentions. Grouped by urgency, ranked by priority and age, stale tickets left out; a source that couldn't be read is named. Any wording routes there, and an answer that skipped it is sent back once. The Jira app gets a by-person read. Data source steps now say what they read instead of "api get".
…ry reads run as tools, commands run after the install (#732) - curl/wget GET or HEAD run through the page check's safety rules and return the status, every header and part of the body; requests that send data, upload, authenticate, write a file or use a proxy are refused with the reason and the read-only form. - Reads chained with ; && || run as their tools in order; git log, git show and git blame run as github_history or a read at a ref; sandbox command chains run as one build with each part asked of the gate; a refused part of a chain is named with the parts that can run. - Sandbox commands run after the repository's install (corepack enable only when the command installs on its own). Exit 127 records the missing program and the routes that work, and a later command that needs it gets that note without another build. - Refused and failed tool events carry their message to the run page while the step runs; the run log line names the actual refusal.
…e labelled; writes carry only the fix's lines (#755) * End-to-end selectors come from a live probe; untaken test branches are labelled; writes carry only the fix's lines A vendor-portal spec's registration-open branch was written from test-id strings found in the vendor's script bundle after the shell refused a Playwright probe. Only the closed branch ever ran, and a later run kept it and re-wrapped lines no formatter checks. The review's probe gate read only added, single-line getByTestId calls and ran only in the reviewer. - common::e2e::probe reads wrapped and pattern ids, holds kept ids too, treats framed pages as outside, and records states and clicks. - common::e2e::branches finds test branches on page state and which arm a report or a probe would take. - common::diff_shape tells and puts back formatting-only hunks. - worker::live_guard refuses coder writes with unprobed outside ids or only formatting, commits probe records, and feeds the habits check. * Format the incident files
… item (#757) * WAF alarm runs read their evidence; a missing AWS read is one install item A run for a WAF signature-drift alarm ended needs_input asking a person to grant the team's read-only role WAF and Athena access. The role's setup script never added any WAF read, and logs held in S3 were never read. - The setup script adds coderhelm-read-waf: wafv2 Get/List, read-only Athena queries in the WAF log workgroups over the Glue tables on aws-waf-logs-* buckets, s3:PutObject only under the workgroup's results prefix, everything else denied. waf_update_line is the one-line CloudShell update for an existing role. - alarm_evidence reads a web ACL's S3 logs through Athena: one bounded query (last three hours, the alarm's rule), keeping only JA4, JA3, user agent, accept language, path, cookie presence and counts. - A refused read is recorded once per account (aws_role_reads) and shown as the "AWS role reads" setup check with the update line; the run names it in one line and goes on. - The stop judge turns an access ask or a hold on the role's reads into a proceed, the hand-back list no longer carries it, and an access question shows no default that can't happen and gets no deadline. - Incident bo replays the run; self-host docs updated. * Format the incident files
…a blame (#754) * A red check is reproduced against the base branch before a revert or a blame Before a CI fix round the failure is read from its own report (test, error, screenshot, report link) and the failing test runs with the head's test code against the base branch's deployment and the pull request's preview; both results and each failing check's result on the base head are kept on the run. A revert of CoderHelm's own work needs a record showing the change caused the failure. Blame and "couldn't confirm" sentences are held against the record. The description's CI failing section and revert lines are rebuilt for the head. * Format the incident files
…hecks test by test (#758) A re-review after an approval or a review reads only the pull request's own change since then; files a base merge brought in are left out, and a finding calling a file outside the merge-base diff unrelated is dropped. A passing end-to-end run on the head whose report shows the test ids is a probe record; for what is still unobserved the reviewer runs the probe itself and decides from its record. A red check is read test by test from each failing test's own error, tests in touched specs first, never as the base branch's by its name. Blame and revert sentences the comparison doesn't back are held. On CoderHelm's own pull request a request for a test always goes to the coder, with how to test a script (stubs on PATH, fixtures).
nambok
left a comment
There was a problem hiding this comment.
good gap to close, main has nothing for a ticket whose PR already merged (covering.rs:20 even says merged PRs take the normal path). but this decides it differently from how we handle open PRs, and it hands work back:
-
no coverage check. it stops on any merged PR whose title or branch has the key (
ticket_history.rs:235, thenmerged_ticket.rs:118). example: someone merges "WEB-42: add logging for the investigation" as prep, and the real fix run for WEB-42 gets stopped.existing_workasks whether the PR actually covers the ticket, and skips when the diagnosis wants a separate change (stop_gate.rs:435). merged PRs should go through that same verdict. -
hands back instead of finishing. it ends in
needs_inputwithHumanOnly::ProductDecision(mod.rs:9799). when the merged PR covers the ticket it should end as covered/complete likecovered_by_prdoes. only ask a person if it really can't decide. -
edits after the merge are ignored. the worker refuses runs without
after_merge/person_direction(mod.rs:9684), anddecide()skips every non-explicit event before thechanged()/pr_open()branches (trigger_gate.rs:162). so if a jira ticket gets new acceptance criteria after its first PR merged, nothing happens until someone hits retry. a content change should get through to the verdict. -
the cap of 3 failed runs in a row (
trigger_gate.rs:151) looks good, but it's unrelated, can you split it into its own PR?
minor:
- retry on a normal merged run doesn't carry
after_merge, so it gets stopped once and needs a second retry. - only the newest 100 PRs per repo get scanned (you already called that out).
merges clean with main and tests pass with main merged in, so it's just the behavior above
…amed instead of rolling back (#760) * A red check is reproduced against the base branch before a revert or a blame Before a CI fix round the failure is read from its own report (test, error, screenshot, report link) and the failing test runs with the head's test code against the base branch's deployment and the pull request's preview; both results and each failing check's result on the base head are kept on the run. A revert of CoderHelm's own work needs a record showing the change caused the failure. Blame and "couldn't confirm" sentences are held against the record. The description's CI failing section and revert lines are rebuilt for the head. * Format the incident files * A CI fix is pushed only after its own checks pass, and red CI stops named instead of rolling back - run_checks runs the owning package's own scripts: its whole unit suite when a non-test file changed, only the touched test files otherwise, and its type check and lint. The test line taken from the first workflow (another package's suite with --passWithNoTests) no longer stands in. - A CI fix round's commit is held when its checks are red or never ran on its last edit, and when it removes a definition a test still names; one the sandbox couldn't check is pushed with an Unverified: line and what ran. - Every round's commit message is checked against its diff and rewritten from it when they disagree. - Two pushed fixes per failing test, kept on the run; then the rounds stop with the test and its error named. Red checks never roll a ticket run's branch back to an older green head or take a planned task out; only a dependency run's newest set of bumps comes out. - An unreadable CI log gets the package's commands to reproduce it locally. - The habits check sends back fixture ids invented while the run looked up real ones, and test cases that differ only in their values. - Incidents ga and gb replay both pull requests; docs/coder-loop.md step 7. * Keep a blank line before the commit and push step * Put commit and push before rounds agree in the coder loop page
) * A red check is reproduced against the base branch before a revert or a blame Before a CI fix round the failure is read from its own report (test, error, screenshot, report link) and the failing test runs with the head's test code against the base branch's deployment and the pull request's preview; both results and each failing check's result on the base head are kept on the run. A revert of CoderHelm's own work needs a record showing the change caused the failure. Blame and "couldn't confirm" sentences are held against the record. The description's CI failing section and revert lines are rebuilt for the head. * Format the incident files * A CI fix is pushed only after its own checks pass, and red CI stops named instead of rolling back - run_checks runs the owning package's own scripts: its whole unit suite when a non-test file changed, only the touched test files otherwise, and its type check and lint. The test line taken from the first workflow (another package's suite with --passWithNoTests) no longer stands in. - A CI fix round's commit is held when its checks are red or never ran on its last edit, and when it removes a definition a test still names; one the sandbox couldn't check is pushed with an Unverified: line and what ran. - Every round's commit message is checked against its diff and rewritten from it when they disagree. - Two pushed fixes per failing test, kept on the run; then the rounds stop with the test and its error named. Red checks never roll a ticket run's branch back to an older green head or take a planned task out; only a dependency run's newest set of bumps comes out. - An unreadable CI log gets the package's commands to reproduce it locally. - The habits check sends back fixture ids invented while the run looked up real ones, and test cases that differ only in their values. - Incidents ga and gb replay both pull requests; docs/coder-loop.md step 7. * Scope is decided once and held; the description describes the head A pull request's path-page work went in, came out, and its tests came back; its plan left three product questions open and its description said the path pages were out of scope while the diff changed them. - common::scope_ledger: the ticket's acceptance criteria (in scope) and the plan's Out of scope lines, each with a reason and the names, paths or routes that show it; open questions decided with their default. - Plan gate: design.md must have Out of scope; open questions, items without a reason, items a criterion asks for, tasks naming an out-of-scope item and open-ended tasks go back. The ledger is written when the plan is generated, before any code, and never rewritten. - Every round: the tests and scope check sends back out-of-scope items the diff brings in, tests included; planned-work rounds skip them; a Scope change line must cite a criterion or a person's comment. - Description, on every build: one Out of scope line from the ledger; question and history sections go; sentences the diff refutes go; the notes fit a length scaled to the changed code. defects() fails a body that asks an open product question. - Incidents sl_scope_decided_once and sm_description_of_the_head; docs/coder-loop.md steps 8 and 9. * Keep a blank line before the commit and push step * Put commit and push before rounds agree in the coder loop page * Run the scope ledger after the live page facts; doc steps follow commit and push
A review body, a settled thread and a merged pull request's reviews were cleaned up only when CoderHelm posted a new review. Now the same cleanup runs on a push, when checks finish, on a merge or a close, and on the review sweep: - a review body for an older commit than the head becomes one line (verdict, the commit it reviewed, why); a request for changes keeps its reasons until the next review replaces it; - on a merge or a close every body becomes one line and CoderHelm's resolved threads are hidden; - a failing-check thread resolves once the head's checks pass, a thread whose file or lines left the diff resolves, and CoderHelm's comments in them are hidden; - a new review keeps only its verdict, why and what holds the merge in sight; the overview, file table, risk, FYI, verification, tests and earlier comments fold under one collapsed block. Only CoderHelm's own reviews, comments and threads are changed, never a thread a person opened or one with a person's reply waiting, and nothing is posted to announce it.
On one team's app, watched over seven months, duplicate runs made up most of CoderHelm's unmerged pull requests. A retry, a ticket edit, or a run started while the first pull request had merged into an integration branch rebuilt the same change from nothing. Before a fresh run on a person's ticket (a Jira key or a GitHub issue) does any work, it now checks the ticket's pull requests: the ones its earlier runs opened, and any whose title, branch or description names the ticket, by any author and into any base branch. CoderHelm already reads these for the ticket's history. When one merged, the run stops before a repository is picked or a model is called. The run page and the ticket say which pull request merged, into which branch and when, and how to run the ticket anyway. The run ends waiting on a person, with `stop_kind: already_merged`. A person runs the ticket anyway by pressing Retry on the stopped run, reopening the Jira ticket, or replying on the ticket with what is still to do. A run started that way is recorded, so its retries and later runs on the ticket aren't stopped by the same merge; a newer merge stops them again. CoderHelm's own work (alerts, log findings, flaky tests, security fixes, plan tasks) is never stopped, because the same finding can come back after its fix merged. The trigger gate: - A ticket edit after such a stop starts nothing, so the ticket doesn't collect one stop after another. Reopening it, or Retry, starts the work. - After 3 failed runs in a row, an event that leaves the ticket unchanged starts no further run. A field or status change used to start the same failing run every time. An edit, a reopen, Retry or a command still start one. Open pull requests that already do the work were handled before this change and still are. Deferred: - Holding a run while the ticket's blocking links are open: the Jira app doesn't send issue links yet, and what happens when a blocker closes is a product decision. - A ticket-level target-branch field: a target branch written in the ticket text is already honoured. A field needs the Jira app to send custom fields and a decision on which field to read.
… reworked change
|
Thanks for the review. What changed, point by point (head
Minor. Retry on a merged run, or on one that ended covered by a merged pull request, carries the after-merge override, so it isn't stopped once and needing a second retry. The 100-pull-request scan limit stays called out in the description. The description lists what wasn't driven live and three staging checks. |
nambok
left a comment
There was a problem hiding this comment.
thanks, this is a lot better. going down my list:
- coverage check: done. merged PRs now get the same verdict as open ones (
merged_work,mod.rs:9881,stop_gate::merged_verdict,stop_gate.rs:520), and the prep PR case ("WEB-42: add logging") comes back unrelated so the run goes on (merged_ticket.rs:213). own-PR detection now goes by title/branch/run/closing ref, not by a mention in the description (ticket_history.rscandidates). - hand back: done. covers ends
covered_by_prthroughcovering::finishwithOutcome::Merged(mod.rs:9980). partial builds only the rest. only an unreadable verdict waits on a person, after one retry. - edits after the merge: done.
decide()lets a content change or reopen through after a merged run (trigger_gate.rs:145), and the worker runs the verdict instead of refusing. - failed-run cap: split out, gone from this PR.
minor: retry on a merged/covered run now carries after_merge (api.rs:2669). the 100 PR scan is still there but it's listed as a known limit, fine.
one real problem left:
an answer on the ticket throws away the partial note and turns the check off. mod.rs:9901 skips the whole check when msg.person_direction.is_some(), and records after_merge on the run, so every later run on that ticket skips it for the same merge too. but person_direction isn't only "run it anyway": ticket_comments::fresh_run (ticket_comments.rs:671) and the jira comment path (jira_comment.rs:281 with_direction) set it whenever someone answers a run that ended waiting or failed. and fresh_run builds the message with ..Default::default(), so merged_note is dropped.
example: WEB-42, #12 merged half of it. R2 gets a partial verdict, builds the rest, then stops asking a question. someone answers on the ticket. R3 starts with person_direction, no merged note, skips the check, and rebuilds everything #12 already did. that's the duplicate this PR is meant to stop.
change wanted:
mod.rs:9901: only skip onmsg.after_merge. for jira replies, setafter_mergeonly when the ticket's latest run ended on the merge (stop_kind == already_merged, or merged), the same waycommand_after_mergedoes it for github (github_webhook.rs:1704). any other answer goes through the verdict like a normal run.ticket_comments.rs:689(fresh_run): carrymerged_notefrom the ended run, likeretry_notedoes for retry, so the restarted run keeps "build only the rest" even before the fresh verdict.- a test for it: partial run, ended waiting, answered, the new run still gets the verdict / keeps the note.
nit, not blocking: in blocking (merged_ticket.rs:172) any revert newest of all turns the check off, even when it reverts a prep PR and the real fix is still merged (e.g. Revert "WEB-42: add logging" after the fix #12). reverted_pr already knows the target, so dropping just the target and the revert and judging the rest would close that. ok as a follow up since you listed it.
fmt, clippy -D warnings and tests on common/gateway/worker pass on the head and with main merged in, CI green on f34770a.
|
Thanks. Head is now
Revert nit: agreed, and left as a follow-up as you suggested; it stays in the description's known limits (dropping just the reverted target and the revert, and judging the rest). |
The merge-base changed after approval.
…ed (#773) * Stop restarting a ticket whose last 3 runs failed while it is unchanged A failed latest run never blocked a ticket event, so every field or status change on a ticket whose runs kept failing started the same failing run again. There was no per-ticket cap. After 3 runs in a row ended failed, an event that leaves the ticket unchanged now starts no further run. The cap counts only runs that ended failed: a run a person retried (status `retried`, whatever it ended as) neither counts nor ends the streak. Changing the ticket, reopening it, or a person's Retry or command still starts a run; explicit triggers never reach the cap. Split out of #706 at the reviewer's request. * no-mistakes(review): Exempt GitHub trigger-label re-adds from failed-run cap * Person's retry gestures on GitHub and Jira never reach the failed-run cap (review on #773) * One trigger-label rule for Jira, one retry-gesture rule for GitHub * no-mistakes(test): Stop Jira status moves from skipping the failed-run cap * no-mistakes(document): Reflow failed-run cap note in trigger gate doc --------- Co-authored-by: Shoyu <shoyu@hmdnyc-v29dlvcg.tail1a3f79.ts.net>
On one team's app, watched over seven months, duplicate runs made up most of CoderHelm's unmerged pull requests. A retry, a ticket edit, or a run started while the first pull request had merged into an integration branch rebuilt the same change from nothing. Open pull requests already get a coverage verdict before a run builds anything (
existing_work); merged ones went the normal path. This change gives a merged pull request the same verdict.What changes
Before a fresh run on a person's ticket (a Jira key or a GitHub issue) builds anything, after its triage and the ticket's own diagnosis and next to the open-PR check, the ticket's merged pull requests since its last revert (up to the newest 3, read together in one call) are compared with the ticket by the same coverage verdict open pull requests get:
covered_by_pr, linked to the newest of them, with a note on the run page and the ticket saying which pull request merged, into which branch and when, why it covers the ticket, and how to run the ticket anyway. Nothing is built and no person is asked.stop_kind: already_merged).A ticket whose diagnosis asks for a separate change skips the check, as it does for open pull requests.
A pull request counts as the ticket's own when an earlier CoderHelm run opened it for the ticket, its title or head branch carries the ticket key, or, for a GitHub issue
#<n>, its title carries#<n>or its description has a GitHub closing reference ("Fixes #42") to that issue in the same repository. It counts whoever wrote it and whatever base branch it merged into, integration branches included. A pull request that only mentions the ticket in its description never counts. For a GitHub issue, only pull requests and runs in the issue's own repository count. When the newest merged pull request is a revert (titleRevert "…"or branchrevert-…, including a Revert-button pull request that points at one that counts), the work was undone and nothing is checked.CoderHelm's own work (alerts, log findings, flaky tests, security fixes, plan tasks) is never checked, because the same finding can come back after its fix merged.
Running the ticket anyway
A person asking for the run after the merge skips the check and the run goes ahead:
POST /api/runs/{run_id}/retry), so it is never stopped once and needing a second retry; such a retry carries no stale partial-merge note;@coderhelm(or/coderhelm) on the issue with what is still to do, or starting the issue from the dashboard.A run started that way is recorded, so its retries and later runs on the ticket skip the check for the same merge; a newer merge is checked again.
Trigger gate
After a merged latest run, an edit that changes the ticket's content or a status change out of done starts a run, and that run reaches the worker's check instead of rebuilding the merged work: new acceptance criteria added after the merge get built. Any other event starts nothing. A run that ended covered by a merged pull request is a handled ticket like any other: only new content starts another run.
The API documentation for
stop_kindand Retry is updated (docs/api/openapi.jsonregenerated). The cap on failed runs in a row that an earlier version of this pull request carried is split out into its own pull request, at the reviewer's request.Evidence
cargo fmt --checkclean;cargo clippy -p common -p gateway -p worker --all-targets -- -D warningsclean;cargo test -p common -p gateway -p workerpassed: common 2752 (including themerged_ticketcarry and answer rules), gateway 1085, worker 2203 (including the answer-path tests inticket_commentsandjira_comment). One environmental failure,model_route_eval::route_implement_fixture_is_sound, because the host's Python 3.8 can't import the fixture'slist[str]. The branch merges cleanly with currentmain.Not driven live (the gateway needs real AWS services and the worker the GitHub API and a model, none reachable where this was validated):
covered_by_pr(stop_kind: already_merged) and builds nothing.Suggested staging checks: (1) start a run on a ticket whose pull request already merged and confirm it ends covered; (2) merge a prep pull request that names the key and confirm the fix run goes ahead; (3) press Retry on a run that got a partly-covered verdict and confirm its instructions carry exactly one up-to-date "Already merged for this ticket" section.
Known limits and follow-ups
Revert "WEB-42: add logging"after the fix); a note a retried run carried from before the revert also stays. Follow-up: drop just the reverted pull request and the revert, and judge the rest.